﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace JZ.Common
{
    public static class ValidationHelper
    {
        public static bool IsNumber(string inputStr)
        {
            return Regex.IsMatch(inputStr, "^[0-9]*$");
        }

        public static bool IsFloat(string inputStr)
        {
            return Regex.IsMatch(inputStr, "^[0-9]+(.[0-9]*)?$");
        }

        public static bool IsEmail(string inputStr)
        {
            return Regex.IsMatch(inputStr, @"^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$");
        }
    }
}
